home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 May: Tool Chest / Dev.CD May 98 TC.toast / Tool Chest / Development Kits / HyperCard Related / APDA HyperCard Toolkits / HyperCard Serial Toolkit 2.6 / Source Code / SPortBufferSize.p < prev    next >
Encoding:
Text File  |  1995-02-07  |  1.5 KB  |  64 lines  |  [TEXT/MPS ]

  1. (*
  2.     SPortBufferSize() -- Returns the size of the current input buffer, or zero if the default buffer is
  3.         begin used.
  4.  
  5.     To compile and link this file using Macintosh Programmer's Workshop,
  6.  
  7.         pascal -w SPortBufferSize.p
  8.         link -m ENTRYPOINT -o HyperCommands -rt XFCN=7034 -sn Main=SPortBufferSize ∂
  9.             SPortBufferSize.p.o "{MPW}"Libraries:interface.o "{MPW}"Libraries:Libraries:HyperXLib.o
  10.  
  11.     © Copyright 1987,88,89 by Apple Computer, Inc.
  12.  
  13.     Initial coding 9/87 by Harry R. Chesley.
  14. *)
  15.  
  16. {$R-}
  17.  
  18. {$S SPortBufferSize }     { Segment name must be the same as the command name. }
  19.  
  20. unit DummyUnit;
  21.  
  22. interface
  23.  
  24. uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
  25.  
  26. procedure EntryPoint(paramPtr: XCmdPtr);
  27.     
  28. implementation
  29.  
  30. procedure SPortBufferSize(paramPtr: XCmdPtr); forward;
  31.  
  32. procedure EntryPoint(paramPtr: XCmdPtr);
  33.  
  34.     begin
  35.         SPortBufferSize(paramPtr);
  36.     end;
  37.  
  38. procedure SPortBufferSize(paramPtr: XCmdPtr);
  39.  
  40.     var l: longInt;
  41.         s: Str255;
  42.  
  43.     procedure Fail(errMsg: Str255); { set theResult and quit }
  44.         begin
  45.             paramPtr^.returnValue := PasToZero(paramPtr,errMsg);
  46.             exit(SPortBufferSize);
  47.         end;
  48.  
  49.     {$I SPortUtil.inc}
  50.  
  51.     begin
  52.         if paramPtr^.paramCount <> 0 then Fail('parameter count is not 0');
  53.  
  54.         SetUpSPortGlobals;
  55.         EnsureOpenPort;
  56.  
  57.         { Find and return the size of the current buffer (or zero if the default buffer is being used). }
  58.         if ThisSPort.inputBuffer = nil then l := 0
  59.         else l := GetPtrSize(ThisSPort.inputBuffer);
  60.         LongToStr(paramPtr,l,s);
  61.         paramPtr^.returnValue := PasToZero(paramPtr,s)
  62.     end;
  63. end.
  64.